package service;

import bean.User;
import dao.UserDao;

import java.util.List;

/**
 * @ClassName : UserService
 * @Auther : acerolan@foxmail.com
 * @Data : 2024/4/17 11:15
 * @Description :
 */

public class UserService {

    private UserDao dao = new UserDao();

    public int UserMoneyCharge(User user) {
        return dao.UserMoneyCharge(user);
    }

    public User login(String username, String psw) {
        return UserDao.login(username, psw);
    }
    public int enroll(User user){
        return UserDao.enroll(user);
    }
    public boolean getByUsername(String nickname){
        return UserDao.getByUsername(nickname);
    }


    public User getUserInfoById(String user_id) {
        return dao.getUserInfoById(user_id);
    }

    public int userMoneyCost(String user_id, String cost) {
        return dao.userMoneyCost(user_id, cost);
    }

    public List<User> getAllUser(){return UserDao.getAllUser();}

    public int insert(User user){
        return UserDao.insertUser(user);
    }

    public int delUser(String username){return UserDao.delForUserName(username);}

    public int updateUser(User user){return UserDao.updUserForUserName(user);}

    public List<String> getUsername(){return UserDao.getAllUsername();}

    public String getId(String username){return UserDao.getIdByUsername(username);}
    public String getUsername(String id){return UserDao.getUsernameById(id);}

    public int UserIconUpdate(String user_id, String icon) {
        return dao.UserIconUpdate(user_id, icon);
    }

}
